<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>作业1</title>
</head>

<body>
    <script>
        // 第二题
        // function sum(num1 = 0, num2 = 0) {
        //     let sum = num1 + num2
        //     return sum
        // }

        // 第三题
        // let num1 = 1
        // let num2 = 2
        // let changeNum = function (num1, num2) {
        //     let tamp = num1
        //     num1 = num2
        //     num2 = tamp
        //     return console.log(`第一个值的结果是${num1}，第二个值的结果是${num2}`)
        // }

        // changeNum(num1, num2)

        第四题
        function lastMoney() {
            let money = prompt('请输入银行卡余额')
            let eat = prompt('请输入本月食宿消费金额')
            let life = prompt('请输入本月生活消费金额')
            let last_money = money - eat - life
            document.write(`当前银行卡剩余金额为${last_money}`)
            return last_money
        }

        lastMoney()
    </script>
</body>

</html>